//index.js
//获取应用实例
const app = getApp();

Page({
  data: {
    content: '', // 输入框中的值
    current: 0
  },

  // 跳转搜索
  serach() {
    wx.navigateTo({
      url: '/pages/serach/serach',
    })
  },

  classification(e) {
    let current = e.currentTarget.dataset.current;
    switch (current) {
      case 0: // 跳转可回收物
        current = 0;
        break;
      case 1: // 跳转有害垃圾
        current = 1;
        break;
      case 2: // 跳转湿垃圾
        current = 2;
        break;
      case 3: // 跳转干垃圾
        current = 3;
        break;
      default:
        console.log()
    }
    this.setData({
      current: current
    })
    this.goClassiFication();
  },

  // 跳转
  goClassiFication() {
    getApp().globalData.current = this.data.current;
    wx.switchTab({
      url: '/pages/classification/classification',
    })
  },

  onLoad: function() {

  }
})